package com.hetao.singleton;


/**
 * Created by hetao on 2018/3/19.
 */
public class LogFactory {
    private static boolean initialized=false;

    private LogFactory(){
        synchronized (LogFactory.class){
            if(!initialized){
                initialized=!initialized;
            }else{
                throw new RuntimeException("单例已被侵犯");
            }
        }
    }

    private LogFactory getInstance(){
        return LogFactoryHolder.logFactory;
    }

    private static class LogFactoryHolder{
        private static final LogFactory logFactory=new LogFactory();
    }

}
